package com.tuozixuan.springboot2demo.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.tuozixuan.springboot2demo.dao.UserDao;
import com.tuozixuan.springboot2demo.model.User;
import com.tuozixuan.springboot2demo.service.UserService;

@Controller
@RequestMapping("user")
public class UserController {
	
	@Autowired
	private UserDao UserDao;
	
	@Autowired
	private UserService userService;

	@ResponseBody
	@GetMapping("/getName")
	public String getName(@RequestParam("userId")String userId) {
		User user = UserDao.getUserById(424632229840027648L);
		return user.getName(); 
	}
	
	@ResponseBody
	@GetMapping("/redisTest")
	public String redisTest() {
		userService.redisTest();
		return "ok";
	}
}
